package br.com.hmcontabilidade.online.view;

import javax.inject.Inject;
import br.gov.frameworkdemoiselle.annotation.PreviousView;
import br.gov.frameworkdemoiselle.stereotype.ViewController;
import br.gov.frameworkdemoiselle.template.AbstractEditPageBean;
import br.gov.frameworkdemoiselle.transaction.Transactional;
import br.com.hmcontabilidade.online.business.CategoriaArquivoBC;
import br.com.hmcontabilidade.online.entity.CategoriaArquivo;

@ViewController
@PreviousView("/categoriaArquivo_list.xhtml")
public class CategoriaArquivoEditMB extends AbstractEditPageBean<CategoriaArquivo, Long> {

	private static final long serialVersionUID = 1L;

	@Inject
	private CategoriaArquivoBC categoriaArquivoBC;
	
	@Override
	@Transactional
	public String delete() {
		this.categoriaArquivoBC.delete(getId());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String insert() {
		this.categoriaArquivoBC.insert(getBean());
		return getPreviousView();
	}
	
	@Override
	@Transactional
	public String update() {
		this.categoriaArquivoBC.update(getBean());
		return getPreviousView();
	}
	
	@Override
	protected void handleLoad() {
		setBean(this.categoriaArquivoBC.load(getId()));
	}

}